package com.ibeeking.found.report.service.common.constant;


import java.util.ArrayList;
import java.util.List;

/**
 *
 */
public class ExpConstant {
    public static final String LIST_EXP = "${";
    public static final String LIST_EXP2 = "#{";
    public static final String GROUP_RIGHT = "groupRight(";
    public static final String GROUP = "group(";
    public static final String CUSTOMGROUP = "customGroup(";
    public static final String DYNAMIC = "dynamic(";
    public static final String EACH_TITLE = "eachTitle(";
    public static final String SUM = "=SUM(";
    public static final String[] FUNCTION = {SUM, "=AVERAGE(", "=MAX(", "=MIN(", "=IF(", "=AND(", "=OR(", "=DATE(", "=YEAR(", "=TIME(", "=MONTH(", "=DAY(", "=ROUND(", "=ABS(", "=FLOOR(", "=CEIL(", "=TRUNC(", "=CHAR(", "=CNMONEY(", "=CONCAT(", "=LOWER(", "=UPPER(", "=CASE(", "=COLOR(", "=ROWCOLOR(", "=ISTIME(", "=ISDATE(", "=ISNUMBER(", "=INTVAL(", "=STRVAL("};
    public static final String[] COMPUTE_FUNCTION = {SUM, "=AVERAGE(", "=MAX(", "=MIN("};
    public static final String MAX = "max(";
    public static final String[] FREEMARKER_FUNCTION = {MAX, "min(", "average(", "sum(", "compute(", "date("};
    public static final String[] OPERATOR = {"+", "-", "*", "/"};

    public static List<Integer> getExpFunction(String e) {
        List<Integer> counts = new ArrayList<>();
        for (int i = 0; i < FUNCTION.length; i++) {
            if(e.contains(FUNCTION[i])){
                counts.add(i);
            }
        }

        return counts;
    }

}
